<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>宽和高</title>
    <style>
        .box {
            width: 500px;
            height: 500px;
            background-color: yellow;
        }

        .div1 {
            width: 300px;
            height: 100px;
            background-color: red;
        }

        .div2 {
            width: 80%;
            height: 50%;
            background-color: green;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="div1">width: 300px;height: 100px</div>
        <div class="div2">wdith: 80%(500 * 0.8);height: 50%(500 * 0.5)</div>
        width: 500px; height: 500px;
    </div>
</body>
</html>